<template>
  <div>
    <a-modal
      class="log_model_box"
      :title="pop.title + '日志详情'"
      :visible="pop.isShow"
      :maskClosable="false"
      :width="pop.width"
      okText="确认"
      cancelText="取消"
      @cancel="close"
      :destroyOnClose="true"
    >
      <a-descriptions bordered title="" size="small" :column="1">
        <a-descriptions-item label="单位名称">
          {{ detailInfo.departName }}
        </a-descriptions-item>
        <a-descriptions-item label="操作人">
          {{ detailInfo.operatorName }}
        </a-descriptions-item>
        <a-descriptions-item label="账号">
          {{ detailInfo.operatorAccount }}
        </a-descriptions-item>
        <a-descriptions-item label="操作时间">
          {{ detailInfo.operationTime }}
        </a-descriptions-item>
        <!-- <a-descriptions-item label="审批名称" v-if="pop.title=='时空碰撞'">
          {{detailInfo.approvalsName}}
        </a-descriptions-item> -->
        <a-descriptions-item label="协查函号">
          {{ detailInfo.xchNumber }}
        </a-descriptions-item>
        <a-descriptions-item label="操作模块">
          {{ detailInfo.moduleName }}
        </a-descriptions-item>
        <a-descriptions-item label="操作路径">
          {{ detailInfo.modulePath }}
        </a-descriptions-item>
        <a-descriptions-item label="操作类型">
          {{ detailInfo.operationTypeName }}
        </a-descriptions-item>
        <a-descriptions-item label="使用模型">
          {{ detailInfo.caseEventModelName }}
        </a-descriptions-item>
        <a-descriptions-item label="输入参数">
          {{ detailInfo.paramsInput }}
        </a-descriptions-item>
        <a-descriptions-item label="返回参数">
          <p class="contentBox">{{ detailInfo.paramsOutput }}</p>
        </a-descriptions-item>
      </a-descriptions>
      <template slot="footer">
        <a-button key="back" type="primary" @click="close">
          关闭
        </a-button>
      </template>
    </a-modal>
  </div>
</template>

<script>
import * as api from '@/api/wxSmuggle/LogAuditing.js'
export default {
  // props: ['show'],
  data() {
    return {
      pop: {
        title: '日志详情',
        isShow: false,
        width: 1000
      },
      detailInfo: {}
    }
  },
  // watch: {
  //   show (value) {
  //     this.pop.isShow = value
  //     this.pop.title = this.title
  //     if (value) {

  //     }
  //   }
  // },
  methods: {
    show(detail) {
      this.pop.isShow = true
      this.pop.title = detail.caseEventModelName ? detail.caseEventModelName : ''
      console.log('detail', detail)
      this.getDetail(detail.logId)
    },
    getDetail(id) {
      api
        .getAuditLogsDetailBy({ logId: id })
        .then(res => {
          console.log('res===', res)
          if (res.success) {
            this.detailInfo = res.result
          } else {
            this.$message.warning(res.message)
          }
        })
        .catch(e => {
          this.$message.warn('请求失败！')
        })
        .finally(() => {})
    },
    close(e) {
      this.pop.isShow = false
    }
  }
}
</script>
<style scoped lang="less">
.log_model_box {
  /deep/.ant-descriptions-bordered .ant-descriptions-item-label {
    background-color: #ffffff;
    width: 120px;
    text-align: center;
  }
  /deep/.ant-modal-footer {
    text-align: center;
  }
  /deep/.ant-descriptions-view table {
    width: 800px !important;
    table-layout: fixed !important;
  }
  /deep/.ant-descriptions-item-label {
    width: 100px !important;
    // display: inline-block;
  }
  /deep/.ant-descriptions-item-content {
    // display: inline-block;
  }
  .contentBox {
    height: 500px;
    padding-right: 10px;
    overflow-y: scroll;
    width: 820px !important;
  }
}
</style>
